BBP formula
The Bailey–Borwein–Plouffe formula (BBP formula) is a formula for }}. It was discovered in 1995 by and is named after the authors of the article in which it was published, , , and Plouffe. Before that, it had been published by Plouffe on his own site. The formula is : \pi = \sum_{k = 0}^\infty \left[ \frac{1}{16^k} \left( \frac{4}{8k + 1} - \frac{2}{8k + 4} - \frac{1}{8k + 5} - \frac{1}{8k + 6} \right) \right]. The BBP formula gives rise to a for computing the n''th (hexadecimal) digit of (and therefore also the ''n''th of ) without computing the preceding digits. The existence of this formula came as a surprise. It had been widely believed that computing the ''n''th digit of is just as hard as computing the first ''n digits. Since its discovery, formulas of the general form : \alpha = \sum_{k = 0}^\infty \left[ \frac{1}{b^k} \frac{p(k)}{q(k)} \right] have been discovered for many other irrational numbers \alpha , where p(k) and q(k) are s with integer coefficients and b \geq 2 is an integer . Formulas of this form are known as BBP-type formulas. Given a number \alpha , there is no known systematic algorithm for finding appropriate p(k) , q(k) , and b ; such formulas are discovered . Specializations A specialization of the general formula that has produced many results is : P(s, b, m, A) = \sum_{k=0}^\infty \left[ \frac{1}{b^k} \sum_{j=1}^m \frac{a_j}{(mk+j)^s} \right], where s'', ''b, and m'' are integers, and A = (a_1, a_2, \dots, a_m) is a of integers. The ''P function leads to a compact notation for some solutions. For example, the original BBP formula : \pi = \sum_{k = 0}^\infty \left[ \frac{1}{16^k} \left( \frac{4}{8k + 1} - \frac{2}{8k + 4} - \frac{1}{8k + 5} - \frac{1}{8k + 6} \right) \right] can be written as : \pi = P\big(1, 16, 8, (4, 0, 0, -2, -1, -1, 0, 0) \big). Previously known BBP-type formulae Some of the simplest formulae of this type that were well known before BBP and for which the P'' function leads to a compact notation, are: : \begin{align} \ln\frac{10}{9} &= \frac{1}{10} + \frac{1}{200} + \frac{1}{3\ 000} + \frac{1}{40\,000} + \frac{1}{500\,000} + \cdots \\ &= \sum_{k=1}^\infty \frac{1}{10^k \cdot k} = \frac{1}{10} \sum_{k=0}^\infty \left[ \frac{1}{10^k} \left( \frac{1}{k+1} \right) \right] \\ &= \frac{1}{10} P\big(1, 10, 1, (1) \big), \end{align} : \begin{align} \ln 2 &= \frac{1}{2} + \frac{1}{2 \cdot 2^2} + \frac{1}{3 \cdot 2^3} + \frac{1}{4 \cdot 2^4} + \frac{1}{5 \cdot 2^5} + \cdots \\ &= \sum_{k=1}^\infty \frac{1}{2^k \cdot k} = \frac{1}{2} \sum_{k=0}^\infty \left[ \frac{1}{2^k} \left( \frac{1}{k + 1} \right) \right] \\ &= \frac{1}{2} P\big( 1, 2, 1, (1) \big). \end{align} Plouffe was also inspired by the of the form (the ''P notation can be also generalized to the case where b'' is not an integer): : \begin{align} \arctan\frac{1}{b} &= \frac{1}{b} - \frac{1}{b^3 3} + \frac{1}{b^5 5} - \frac{1}{b^7 7} + \frac{1}{b^9 9} + \cdots \\ &= \sum_{k=1}^\infty \left[ \frac{1}{b^{k}} \frac{\sin\frac{k\pi}{2}}{k} \right] = \frac{1}{b} \sum_{k=0}^\infty \left[ \frac{1}{b^{4k}} \left( \frac{1}{4k+1} + \frac{-b^{-2}}{4k+3} \right) \right] \\ &= \frac{1}{b} P\big( 1, b^4, 4, (1, 0, -b^{-2}, 0) \big). \end{align} The search for new equalities Using the ''P function mentioned above, the simplest known formula for is for s'' = 1, but ''m > 1. Many now-discovered formulae are known for b'' as an exponent of 2 or 3 and ''m as an exponent of 2 or it some other factor-rich value, but where several of the terms of sequence A'' are zero. The discovery of these formulae involves a computer search for such linear combinations after computing the individual sums. The search procedure consists of choosing a range of parameter values for ''s, b'', and ''m, evaluating the sums out to many digits, and then using an (typically 's ) to find a sequence A'' that adds up those intermediate sums to a well-known constant or perhaps to zero. The BBP formula for The original BBP summation formula was found in 1995 by Plouffe using . It is also representable using the ''P function above: : \begin{align} \pi &= \sum_{k = 0}^\infty \left[ \frac{1}{16^k} \left( \frac{4}{8k + 1} - \frac{2}{8k + 4} - \frac{1}{8k + 5} - \frac{1}{8k + 6} \right) \right] \\ &= P\big( 1, 16, 8, (4, 0, 0, -2, -1, -1, 0, 0) \big), \end{align} which also reduces to this equivalent ratio of two polynomials: : \pi = \sum_{k = 0}^\infty \left[ \frac{1}{16^k} \left( \frac{120k^2 + 151k + 47}{512k^4 + 1024k^3 + 712k^2 + 194k + 15} \right) \right]. This formula has been shown through a fairly simple proof to equal . BBP digit-extraction algorithm for We would like to define a formula that returns the n''th digit of . A few manipulations are required to implement a using this formula. We must first rewrite the formula as : \pi = 4 \sum_{k=0}^\infty \frac{1}{(16^k)(8k+1)} - 2 \sum_{k=0}^\infty \frac{1}{(16^k)(8k+4)} - \sum_{k=0}^\infty \frac{1}{(16^k)(8k+5)} - \sum_{k=0}^\infty \frac{1}{(16^k)(8k+6)}. Now, for a particular value of ''n and taking the first sum, we split the to across the n''th term: : \sum_{k=0}^\infty \frac{1}{(16^k)(8k+1)} = \sum_{k=0}^n \frac{1}{(16^k)(8k+1)} + \sum_{k=n+1}^\infty \frac{1}{(16^k)(8k+1)}. We now multiply by 16''n, so that the hexadecimal point (the divide between fractional and integer parts of the number) is in the n''th place: : \sum_{k=0}^\infty \frac{16^{n-k}}{8k+1} = \sum_{k=0}^n \frac{16^{n-k}}{8k+1} + \sum_{k=n+1}^\infty \frac{16^{n-k}}{8k+1}. Since we only care about the fractional part of the sum, we look at our two terms and realise that only the first sum is able to produce whole numbers; conversely, the second sum cannot produce whole numbers, since the numerator can never be larger than the denominator for ''k > n''. Therefore, we need a trick to remove the whole numbers for the first sum. That trick is mod 8''k + 1. Our sum for the first fractional part then becomes : \sum_{k=0}^n \frac{16^{n-k} \bmod (8k+1)}{8k+1} + \sum_{k=n+1}^\infty \frac{16^{n-k}}{8k+1}. Notice how the operator always guarantees that only the fractional sum will be kept. To calculate 16''n''−''k'' mod (8''k'' + 1) quickly and efficiently, the algorithm is used. When the running product becomes greater than one, the modulo is taken, just as for the running total in each sum. Now to complete the calculation, this must be applied to each of the four sums in turn. Once this is done, the four summations are put back into the sum to : : 4 \Sigma_1 - 2 \Sigma_2 - \Sigma_3 - \Sigma_4. Since only the fractional part is accurate, extracting the wanted digit requires that one removes the integer part of the final sum and multiplies by 16 to "skim off" the hexadecimal digit at this position (in theory, the next few digits up to the accuracy of the calculations used would also be accurate). This process is similar to performing , but only having to perform the summation of some middle columns. While there are some that are not counted, computers usually perform arithmetic for many bits (32 or 64) and round, and we are only interested in the most significant digit(s). There is a possibility that a particular computation will be akin to failing to add a small number (e.g. 1) to the number 999999999999999, and that the error will propagate to the most significant digit. BBP compared to other methods of computing This algorithm computes without requiring custom data types having thousands or even millions of digits. The method calculates the n''th digit ''without calculating the first n'' − 1 digits and can use small, efficient data types. Though the BBP formula can directly calculate the value of any given digit of with less computational effort than formulas that must calculate all intervening digits, BBP remains ( O(n \log n) ), whereby successively larger values of ''n require increasingly more time to calculate; that is, the "further out" a digit is, the longer it takes BBP to calculate it, just like the standard -computing algorithms. Generalizations D. J. Broadhurst provides a generalization of the BBP algorithm that may be used to compute a number of other constants in nearly linear time and logarithmic space. Explicit results are given for , \pi^3 , \pi^4 , \zeta(3) , \zeta(5) , (where \zeta(x) is the ), \log^32 , \log^42 , \log^52 , and various products of powers of \pi and \log2 . These results are obtained primarily by the use of s. References Category:Advanced mathematics